diff options
| author | Adam Soltys <[email protected]> | 2024-08-30 20:04:29 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2024-08-30 20:04:29 -0700 |
| commit | c9acca0218d47226c567da62c4a8bf97691c9b0d (patch) | |
| tree | 3986d1c5aac77f256ed1091290bc067c899e2196 /src/routes/(app)/[username]/(profile)/+layout.server.ts | |
| parent | 9a7bb1df8ce1cff544982520add7ca8fdee799f6 (diff) | |
| download | coinos-ui-c9acca0218d47226c567da62c4a8bf97691c9b0d.tar.gz coinos-ui-c9acca0218d47226c567da62c4a8bf97691c9b0d.zip | |
typescript
Diffstat (limited to 'src/routes/(app)/[username]/(profile)/+layout.server.ts')
| -rw-r--r-- | src/routes/(app)/[username]/(profile)/+layout.server.ts | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/routes/(app)/[username]/(profile)/+layout.server.ts b/src/routes/(app)/[username]/(profile)/+layout.server.ts new file mode 100644 index 00000000..a508de92 --- /dev/null +++ b/src/routes/(app)/[username]/(profile)/+layout.server.ts @@ -0,0 +1,26 @@ +import { get } from "$lib/utils"; + +export async function load({ parent }) { + let { subject, user } = await parent(); + + subject.follows = []; + subject.followers = []; + + try { + subject.follows = await get(`/${subject.pubkey}/follows`); + } catch (e) { + console.log("problem fetching follows", e); + } + + try { + subject.followers = await get(`/${subject.pubkey}/followers`); + } catch (e) { + console.log("problem fetching followers", e); + } + + if (user) { + user.follows = await get(`/${user.pubkey}/follows?tagsonly=true`); + } + + return { subject, user }; +} |
